export TOOL_PATH='./bin'

composer_install() {
  wget https://mirrors.aliyun.com/composer/composer.phar -O $TOOL_PATH/composer
  chmod +x $TOOL_PATH/composer
  $TOOL_PATH/composer --version > $TOOL_PATH/composer.version
  shasum $TOOL_PATH/composer > $TOOL_PATH/composer.sum
}

phpcs_install() {
wget https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar -O $TOOL_PATH/phpcs
wget https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar -O $TOOL_PATH/phpcbf
}

phpunit_install() {
  wget -O phpunit https://phar.phpunit.de/phpunit-8.phar -O $TOOL_PATH/phpunit8
  wget -O phpunit https://phar.phpunit.de/phpunit-7.phar -O $TOOL_PATH/phpunit7
  chmod +x $TOOL_PATH/phpunit8
  chmod +x $TOOL_PATH/phpunit7
  cp -rf $TOOL_PATH/phpunit7 $TOOL_PATH/phpunit
}
phive_install() {
  wget -O $TOOL_PATH/phive "https://phar.io/releases/phive.phar"
  wget -O phive.phar.asc "https://phar.io/releases/phive.phar.asc"
  gpg --keyserver hkps.pool.sks-keyservers.net --recv-keys 0x9D8A98B29B2D5D79
  gpg --verify phive.phar.asc $TOOL_PATH/phive 
  rm phive.phar.asc
  chmod +x $TOOL_PATH/phive
}

phpcpd_install() {
  wget https://phar.phpunit.de/phpcpd.phar -O $TOOL_PATH/phpcpd
  chmod +x $TOOL_PATH/phpcpd 
}

phing_install() {
  wget https://www.phing.info/get/phing-latest.phar -O $TOOL_PATH/phing
  chmod +x $TOOL_PATH/phing
}
phpdoc_install() {
  wget http://phpdoc.org/phpDocumentor.phar -O $TOOL_PATH/phpdoc
  chmod +x $TOOL_PATH/phpdoc
}
dephpend_install() {
  wget  --no-check-certificate https://github.com/mihaeu/dephpend/releases/download/0.6.1/dephpend-0.6.1.phar -O $TOOL_PATH/dephpend
  chmod +x $TOOL_PATH/dephpend
}
phpstan_install() {
  wget https://github.com/phpstan/phpstan/releases/download/0.11.16/phpstan.phar -O $TOOL_PATH/phpstan
  chmod +x $TOOL_PATH/phpstan
}
crc_install() {
  wget https://github.com/maglnet/ComposerRequireChecker/releases/download/2.0.0/composer-require-checker.phar -O $TOOL_PATH/composer-require-checker
  chmod +x $TOOL_PATH/composer-require-checker
}
psalm_install() {
  wget https://github.com/vimeo/psalm/releases/download/3.5.1/psalm.phar -O $TOOL_PATH/psalm
  chmod +x $TOOL_PATH/psalm
}
phpdox_install() {
wget http://phpdox.de/releases/phpdox.phar -O -O $TOOL_PATH/phpdox
chmod +x $TOOL_PATH/phpdox
}
phpmd_install() {
wget https://github.com/phpmd/phpmd/releases/download/2.7.0/phpmd.phar -O -O $TOOL_PATH/phpmd
chmod +x $TOOL_PATH/phpmd
}
#composer_install
#phpcs_install
#phpunit_install
#phive_install
phpcpd_install
phing_install
phpdoc_install
dephpend_install
phpstan_install
crc_install
psalm_install
phpdox_install
phpmd_install
